# -*- encoding: utf-8 -*-
"""
File Name: launch
Description:
Author : 'lirui'
date: 2/6/2024
Contact: marjey_lee@163.com
Change Activity:
2/6/2024:
"""
import uvicorn
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware

from app.cli_inspect_server.agents.network_config_inspector import (
    NetworkConfigInspector,
)
import ll
import ll.restful
import ll.llm as llm

_APP = ll.restful.init_fastapi_app(
    title="网络设备配置检查", description="检查网络设备配置文件的语法错误"
)

_INSPECTOR = NetworkConfigInspector.create_default_inspector()

        
@_APP.post("/inspect")
def error_msg(message):
    response = _INSPECTOR(message)
    return response


def _main():
    uvicorn.run(_APP, host="0.0.0.0", port=8080)  # start fast api server


if __name__ == "__main__":
    _main()
